home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume27 / sfs / part17 < prev    next >
Encoding:
Text File  |  1991-12-27  |  55.2 KB  |  1,900 lines

  1. Newsgroups: comp.sources.misc
  2. From: tcamp@hercules.acpub.duke.edu (Ted Campbell)
  3. Subject:  v27i017:  sfs - Space Flight Simulator, Part17/21
  4. Message-ID: <1991Dec24.191854.21065@sparky.imd.sterling.com>
  5. X-Md4-Signature: 3c67e59812b5697b536f798a69fbca03
  6. Date: Tue, 24 Dec 1991 19:18:54 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: tcamp@hercules.acpub.duke.edu (Ted Campbell)
  10. Posting-number: Volume 27, Issue 17
  11. Archive-name: sfs/part17
  12. Environment: IBMPC && EGA/VGA, UNIX-PC && MGR, UNIX && X11,
  13.  
  14. #!/bin/sh
  15. # do not concatenate these parts, unpack them in order with /bin/sh
  16. # file sfs/map/map.c continued
  17. #
  18. if test ! -r _shar_seq_.tmp; then
  19.     echo 'Please unpack part 1 first!'
  20.     exit 1
  21. fi
  22. (read Scheck
  23.  if test "$Scheck" != 17; then
  24.     echo Please unpack part "$Scheck" next!
  25.     exit 1
  26.  else
  27.     exit 0
  28.  fi
  29. ) < _shar_seq_.tmp || exit 1
  30. if test ! -f _shar_wnt_.tmp; then
  31.     echo 'x - still skipping sfs/map/map.c'
  32. else
  33. echo 'x - continuing file sfs/map/map.c'
  34. sed 's/^X//' << 'SHAR_EOF' >> 'sfs/map/map.c' &&
  35. X            prevy, prevx, map_defalt );
  36. X         fprintf( outfile, "5\t%lf\t%lf\t%lf\n",
  37. X            ypos, xpos, map_defalt );
  38. X         break;
  39. X      default:
  40. X         fprintf( outfile, "5\t%lf\t%lf\t%lf\n",
  41. X            prevy, prevx, map_defalt );
  42. X         fprintf( outfile, "5\t%lf\t%lf\t%lf\n",
  43. X            ypos, xpos, map_defalt );
  44. X         break;
  45. X      }
  46. X
  47. X   /* clear the quit and backup areas */
  48. X
  49. X   ui_fbox( qu_x1 - 1, qu_y1, bu_x2, bu_y2,
  50. X      WHITE, SOLID );
  51. X
  52. X   }
  53. X
  54. /****************************************************************
  55. X
  56. X    map_entitle()
  57. X
  58. ****************************************************************/
  59. X
  60. map_entitle()
  61. X   {
  62. X   static int image;
  63. X
  64. X   if ( dial_x1 == 0 )
  65. X      {
  66. X      midx = main_window->u_x1
  67. X     + ((main_window->u_x2 - main_window->u_x1 ) / 2 );
  68. X      midy = main_window->u_y1
  69. X     + ((main_window->u_y2 - main_window->u_y1 ) / 2 );
  70. X      length = ( main_window->u_x2 - main_window->u_x1 ) / 2;
  71. X      dial_x1 = midx - length / 2;
  72. X      dial_x2 = midx + length / 2;
  73. X      height = ( main_window->u_y2 - main_window->u_y1 ) / 2;
  74. X      dial_y1 = midy - height / 2;
  75. X      dial_y2 = midy + height / 2;
  76. X
  77. X      }
  78. X
  79. X   gr_imsave( GR_PRIMARY, TRUE, dial_x1, dial_y1,
  80. X      dial_x2, dial_y2, &image );
  81. X   ui_dial( dial_x1, dial_y1, dial_x2, dial_y2,
  82. X      cl_mback, cl_mfore, cl_marker,
  83. X      TRUE, ENT_TITLE,
  84. X      ENT_TEXT, ENT_PROMPT, buffer, &dial_window );
  85. X   gr_imsave( GR_PRIMARY, FALSE, dial_x1, dial_y1,
  86. X      dial_x2, dial_y2, &image );
  87. X   gr_imfree( image );
  88. X
  89. X   fprintf( outfile, ";----------------------------------------------------------------\n" );
  90. X   fprintf( outfile, ";\n" );
  91. X   fprintf( outfile, ";\t%s\n", buffer );
  92. X   fprintf( outfile, ";\n" );
  93. X
  94. X   }
  95. X
  96. /****************************************************************
  97. X
  98. X    map_altitude()
  99. X
  100. ****************************************************************/
  101. X
  102. map_altitude()
  103. X   {
  104. X   static double n;
  105. X   static int image;
  106. X   
  107. X   if ( dial_x1 == 0 )
  108. X      {
  109. X      midx = main_window->u_x1
  110. X         + ((main_window->u_x2 - main_window->u_x1 ) / 2 );
  111. X      midy = main_window->u_y1
  112. X         + ((main_window->u_y2 - main_window->u_y1 ) / 2 );
  113. X      length = ( main_window->u_x2 - main_window->u_x1 ) / 2;
  114. X      dial_x1 = midx - length / 2;
  115. X      dial_x2 = midx + length / 2;
  116. X      height = ( main_window->u_y2 - main_window->u_y1 ) / 2;
  117. X      dial_y1 = midy - height / 2;
  118. X      dial_y2 = midy + height / 2;
  119. X
  120. X      }
  121. X
  122. X   gr_imsave( GR_PRIMARY, TRUE, dial_x1, dial_y1,
  123. X      dial_x2, dial_y2, &image );
  124. X   ui_dial( dial_x1, dial_y1, dial_x2, dial_y2,
  125. X      cl_mback, cl_mfore, cl_marker,
  126. X      TRUE, ALT_TITLE,
  127. X      ALT_TEXT, ALT_PROMPT, buffer, &dial_window );
  128. X   gr_imsave( GR_PRIMARY, FALSE, dial_x1, dial_y1,
  129. X      dial_x2, dial_y2, &image );
  130. X   gr_imfree( image );
  131. X
  132. X   sscanf( buffer, "%lf",  &n );
  133. X   }
  134. X
  135. /****************************************************************
  136. X
  137. X    map_exit()
  138. X
  139. ****************************************************************/
  140. X
  141. map_exit()
  142. X   {
  143. X   kb_deinit();
  144. X   gr_deinit();
  145. X   }
  146. X
  147. /****************************************************************
  148. X
  149. X    map_font()
  150. X
  151. ****************************************************************/
  152. X
  153. map_font( size )
  154. X   int size;
  155. X   {
  156. X   static oldsize = 159;
  157. X   int rq_height;
  158. X
  159. X   if ( size == oldsize )
  160. X      {
  161. X      return;
  162. X      }
  163. X
  164. X   switch( size )
  165. X      {
  166. X      case 1:
  167. X     rq_height = ui_grwind->ymax / 25;
  168. X     break;
  169. X      case 2:
  170. X     rq_height = ui_grwind->ymax / 15;
  171. X     break;
  172. X      default:
  173. X     rq_height = ui_grwind->ymax / 30;
  174. X     break;
  175. X      }
  176. X
  177. X   gr_font( GR_PRIMARY, F_DEFAULT, rq_height );
  178. X   }
  179. X
  180. /****************************************************************
  181. X
  182. X    map_colors()
  183. X
  184. ****************************************************************/
  185. X
  186. map_colors()
  187. X   {
  188. X
  189. X   if ( gr_colors > 8 )
  190. X      {
  191. X      cl_mback = WHITE;
  192. X      cl_mfore = BLACK;
  193. X      cl_marker = DARK_CYAN;
  194. X      cl_grid = DARK_BLUE;
  195. X      cl_surface = DARK_GREEN;
  196. X      }
  197. X   else if ( gr_colors > 2 )
  198. X      {
  199. X      cl_mback = WHITE;
  200. X      cl_mfore = BLACK;
  201. X      cl_marker = BLACK;
  202. X      cl_grid = WHITE;
  203. X      cl_surface = WHITE;
  204. X      }
  205. X   else
  206. X      {
  207. X      cl_mback = WHITE;
  208. X      cl_mfore = BLACK;
  209. X      cl_marker = WHITE;
  210. X      cl_grid = WHITE;
  211. X      cl_surface = WHITE;
  212. X      }
  213. X
  214. X   }
  215. X
  216. /****************************************************************
  217. X
  218. X    bw_error()
  219. X
  220. ****************************************************************/
  221. X
  222. bw_error( mes )
  223. X   char *mes;
  224. X   {
  225. X   static char buffer[ BW_EBUFSIZE ];
  226. X   static int image;
  227. X   static int x1 = 0, x2, y1, y2, height, length, midx, midy, c;
  228. X   static struct uiwindow *err_window;
  229. X
  230. X   if ( x1 == 0 )
  231. X      {
  232. X
  233. X      midx = main_window->u_x1 + ( ( main_window->u_x2 - main_window->u_x1 ) / 2 );
  234. X      midy = main_window->u_y1 + ( ( main_window->u_y2 - main_window->u_y1 ) / 2 );
  235. X
  236. X      length = main_window->u_x2 / 2;
  237. X      x1 = midx - length / 2;
  238. X      x2 = midx + length / 2;
  239. X      height = main_window->u_y2 / 2;
  240. X      y1 = midy - height / 2;
  241. X      y2 = midy + height / 2;
  242. X
  243. X      }
  244. X
  245. X   gr_imsave( GR_PRIMARY, TRUE, x1, y1, x2, y2, &image );
  246. X   buffer[ 0 ] = 0;
  247. X   sprintf( buffer, ERR_PROMPT, mes );
  248. X   c = ui_yn( x1, y1, x2, y2, cl_mback, cl_mfore, cl_marker, TRUE,
  249. X      buffer, ERRP_NO, ERRP_YES, &err_window );
  250. X   gr_imsave( GR_PRIMARY, FALSE, x1, y1, x2, y2, &image );
  251. X   gr_imfree( image );
  252. X
  253. X   if ( c == FALSE )
  254. X      {
  255. X      map_exit();
  256. X      exit( 1 );
  257. X      }
  258. X   }
  259. X
  260. /****************************************************************
  261. X
  262. X    bw_debug()
  263. X
  264. ****************************************************************/
  265. X
  266. #ifdef  DEBUG
  267. bw_debug( mes )
  268. X   char *mes;
  269. X   {
  270. X   static char buffer[ 256 ];
  271. X
  272. X   sprintf( buffer, "DEBUG: %s     ", mes );
  273. X   bw_message( buffer );
  274. X   ui_wait();
  275. X   }
  276. #endif
  277. X
  278. /****************************************************************
  279. X
  280. X    map_sigint()
  281. X
  282. ****************************************************************/
  283. X
  284. map_sigint()
  285. X   {
  286. X   kb_deinit();
  287. X   gr_deinit();
  288. X   exit( 1 );
  289. X   }
  290. X
  291. /****************************************************************
  292. X
  293. X    bw_message()
  294. X
  295. ****************************************************************/
  296. X
  297. bw_message( m )
  298. X   char *m;
  299. X   {
  300. X   ui_fbox( main_window->u_x1, main_window->u_y1,
  301. X      main_window->u_x2, mesg_y - 1, BLACK, SOLID );
  302. X   ui_str( 5, 5, main_window->x2, BLACK, WHITE, m );
  303. X   }
  304. X
  305. ui_poll()
  306. X   {
  307. X   }
  308. SHAR_EOF
  309. echo 'File sfs/map/map.c is complete' &&
  310. chmod 0644 sfs/map/map.c ||
  311. echo 'restore of sfs/map/map.c failed'
  312. Wc_c="`wc -c < 'sfs/map/map.c'`"
  313. test 25899 -eq "$Wc_c" ||
  314.     echo 'sfs/map/map.c: original size 25899, current size' "$Wc_c"
  315. rm -f _shar_wnt_.tmp
  316. fi
  317. # ============= sfs/map/map.h ==============
  318. if test -f 'sfs/map/map.h' -a X"$1" != X"-c"; then
  319.     echo 'x - skipping sfs/map/map.h (File already exists)'
  320.     rm -f _shar_wnt_.tmp
  321. else
  322. > _shar_wnt_.tmp
  323. echo 'x - extracting sfs/map/map.h (Text)'
  324. sed 's/^X//' << 'SHAR_EOF' > 'sfs/map/map.h' &&
  325. /***************************************************************
  326. X
  327. X    map.h           Header file
  328. X            for SFS Map utility
  329. X
  330. X            Copyright (c) 1991, Ted A. Campbell
  331. X
  332. X            Bywater Software
  333. X            P. O. Box 4023
  334. X            Duke Station
  335. X            Durham, NC  27706
  336. X
  337. X            tcamp@hercules.acpub.duke.edu
  338. X
  339. X    Copyright and Permissions Information:
  340. X
  341. X    All U.S. and international copyrights are claimed by the
  342. X    author. The author grants permission to use this code
  343. X    and software based on it under the following conditions:
  344. X    (a) in general, the code and software based upon it may be
  345. X    used by individuals and by non-profit organizations; (b) it
  346. X    may also be utilized by governmental agencies in any country,
  347. X    with the exception of military agencies; (c) the code and/or
  348. X    software based upon it may not be sold for a profit without
  349. X    an explicit and specific permission from the author, except
  350. X    that a minimal fee may be charged for media on which it is
  351. X    copied, and for copying and handling; (d) the code must be
  352. X    distributed in the form in which it has been released by the
  353. X    author; and (e) the code and software based upon it may not
  354. X    be used for illegal activities.
  355. X
  356. ***************************************************************/
  357. X
  358. X
  359. #define MAP_TITLE       "SFS Map Utility, version %s"
  360. #define MAP_VERSION     "1.01"
  361. #define MAP_DEFAULTDATA "test.spd"
  362. #define MAP_DRAW    "Drawing Map..."
  363. #define    MAP_HELP    "Press ESC or Click in Top Bar"
  364. #define MAP_MM        "Main Menu -- Select Item"
  365. #define MAP_SELECT    "Use Arrow Keys to Select Position, then RETURN"
  366. #define MAP_SEQM    "SEQUENCE: Click points -- click top bar to end"
  367. X
  368. #define    MM_TITLE    "Main Menu"
  369. #define MM_POSITION     "Change Position"
  370. #define MM_ENTITLE      "Enter Title or Comment"
  371. #define    MM_SEQUENCE    "Begin Sequence"
  372. #define    MM_ALTITUDE    "Set Default Altitude"
  373. #define    MM_EXIT        "Exit"
  374. X
  375. #define ALT_TITLE    "Set Default Altitude"
  376. #define ALT_TEXT    "Enter the altitude for subsequent sequence points in kilometers."
  377. #define ALT_PROMPT    "Altitude: "
  378. #define ALT_MEMERR      "Cannot allocate memory for dialogue box"
  379. X
  380. #define ENT_TITLE       "Enter Title or Comment"
  381. #define ENT_TEXT        "Enter a title or comment line."
  382. #define ENT_PROMPT      "Title/Comment: "
  383. X
  384. #define SEQ_QUIT        "QUIT"
  385. #define SEQ_BACKUP      "BACKUP"
  386. X
  387. #define ERR_PROMPT      "ERROR:  %s; Do you want to continue? "
  388. #define ERRP_NO         "N - ABORT"
  389. #define ERRP_YES        "Y - Continue"
  390. #define ERR_MATH        "Mathematics error, %s"
  391. #define ERR_MOUSE    "You must have a pointer device to enter points"
  392. X
  393. #define    MEMERR_ESC    "Cannot allocate memory for ESCAPE menu"
  394. #define MEMERR_ERR    "Cannot allocate memory for ERROR screen"
  395. #define MEMERR_SEQ    "Cannot allocate memory for next point"
  396. X
  397. #define MM_TITLES       5
  398. X
  399. extern int dr_xsize;            /* Size of ground track map, x */
  400. extern int dr_ysize;            /* Size of ground track map, y */
  401. extern int dr_mapbase;          /* Bottom of gt map */
  402. extern int dr_mapedge;          /* Left edge of groundtrack map */
  403. X
  404. /***    Colors */
  405. X
  406. extern int   cl_mback;      /* Main background color   */
  407. extern int   cl_mfore;      /* Main foreground color   */
  408. extern int   cl_marker;      /* Color for prompt markers   */
  409. extern int   cl_grid;      /* Color for planetary grid   */
  410. extern int   cl_surface;      /* Color for planetary surface   */
  411. X
  412. extern int map_pos[ 10 ][ 4 ];
  413. X
  414. SHAR_EOF
  415. chmod 0644 sfs/map/map.h ||
  416. echo 'restore of sfs/map/map.h failed'
  417. Wc_c="`wc -c < 'sfs/map/map.h'`"
  418. test 3311 -eq "$Wc_c" ||
  419.     echo 'sfs/map/map.h: original size 3311, current size' "$Wc_c"
  420. rm -f _shar_wnt_.tmp
  421. fi
  422. # ============= sfs/map/map.mak ==============
  423. if test -f 'sfs/map/map.mak' -a X"$1" != X"-c"; then
  424.     echo 'x - skipping sfs/map/map.mak (File already exists)'
  425.     rm -f _shar_wnt_.tmp
  426. else
  427. > _shar_wnt_.tmp
  428. echo 'x - extracting sfs/map/map.mak (Text)'
  429. sed 's/^X//' << 'SHAR_EOF' > 'sfs/map/map.mak' &&
  430. PROJ    =MAP
  431. DEBUG    =0
  432. CC    =qcl
  433. CFLAGS_G    = /AL /W1 /Ze /DDEBUG /I..\..\include
  434. CFLAGS_D    = /Zi /Zr /Gi$(PROJ).mdt /Od 
  435. CFLAGS_R    = /O /Ot /DNDEBUG 
  436. CFLAGS    =$(CFLAGS_G) $(CFLAGS_R)
  437. LFLAGS_G    =/NOI
  438. LFLAGS_D    =/INCR /CO
  439. LFLAGS_R    =
  440. LFLAGS    =$(LFLAGS_G) $(LFLAGS_R)
  441. RUNFLAGS    =
  442. OBJS_EXT =     ..\..\lib\dr_ibmpc.obj ..\..\lib\gr_ibmpc.obj ..\..\lib\kb_ibmpc.obj \
  443. X    ..\..\lib\ui_boxes.obj ..\..\lib\ui_init.obj ..\..\lib\ui_text.obj ..\..\lib\ui_gets.obj \
  444. X    ..\..\lib\ui_dial.obj ..\..\lib\ui_list.obj ..\..\lib\ui_pbm.obj 
  445. LIBS_EXT =     
  446. X
  447. all:    $(PROJ).exe
  448. X
  449. map.obj:    map.c
  450. X
  451. as_vpt.obj:    ..\as\as_vpt.c
  452. X
  453. as_orbit.obj:    ..\as\as_orbit.c
  454. X
  455. as_spj.obj:    ..\as\as_spj.c
  456. X
  457. map_dr.obj:    map_dr.c
  458. X
  459. $(PROJ).exe:    map.obj as_vpt.obj as_orbit.obj as_spj.obj map_dr.obj $(OBJS_EXT)
  460. X    echo >NUL @<<$(PROJ).crf
  461. map.obj +
  462. as_vpt.obj +
  463. as_orbit.obj +
  464. as_spj.obj +
  465. map_dr.obj +
  466. $(OBJS_EXT)
  467. $(PROJ).exe
  468. X
  469. $(LIBS_EXT);
  470. <<
  471. X    link $(LFLAGS) @$(PROJ).crf
  472. X
  473. run: $(PROJ).exe
  474. X    $(PROJ) $(RUNFLAGS)
  475. X
  476. SHAR_EOF
  477. chmod 0644 sfs/map/map.mak ||
  478. echo 'restore of sfs/map/map.mak failed'
  479. Wc_c="`wc -c < 'sfs/map/map.mak'`"
  480. test 941 -eq "$Wc_c" ||
  481.     echo 'sfs/map/map.mak: original size 941, current size' "$Wc_c"
  482. rm -f _shar_wnt_.tmp
  483. fi
  484. # ============= sfs/map/map_dr.c ==============
  485. if test -f 'sfs/map/map_dr.c' -a X"$1" != X"-c"; then
  486.     echo 'x - skipping sfs/map/map_dr.c (File already exists)'
  487.     rm -f _shar_wnt_.tmp
  488. else
  489. > _shar_wnt_.tmp
  490. echo 'x - extracting sfs/map/map_dr.c (Text)'
  491. sed 's/^X//' << 'SHAR_EOF' > 'sfs/map/map_dr.c' &&
  492. /***************************************************************
  493. X
  494. X    map_dr.c        Map drawing routines
  495. X            for SFS Map utility
  496. X
  497. X            Copyright (c) 1991, Ted A. Campbell
  498. X
  499. X            Bywater Software
  500. X            P. O. Box 4023 
  501. X            Duke Station 
  502. X            Durham, NC  27706
  503. X
  504. X            tcamp@hercules.acpub.duke.edu
  505. X
  506. X    Copyright and Permissions Information:
  507. X
  508. X    All U.S. and international copyrights are claimed by the
  509. X    author. The author grants permission to use this code
  510. X    and software based on it under the following conditions:
  511. X    (a) in general, the code and software based upon it may be 
  512. X    used by individuals and by non-profit organizations; (b) it
  513. X    may also be utilized by governmental agencies in any country,
  514. X    with the exception of military agencies; (c) the code and/or
  515. X    software based upon it may not be sold for a profit without
  516. X    an explicit and specific permission from the author, except
  517. X    that a minimal fee may be charged for media on which it is
  518. X    copied, and for copying and handling; (d) the code must be 
  519. X    distributed in the form in which it has been released by the
  520. X    author; and (e) the code and software based upon it may not 
  521. X    be used for illegal activities. 
  522. X
  523. ***************************************************************/
  524. X
  525. #include "stdio.h"
  526. #include "ctype.h"
  527. #include "bw.h"
  528. #include "gr.h"
  529. #include "kb.h"
  530. #include "ui.h"
  531. #include "as.h"
  532. #include "map.h"
  533. X
  534. #ifdef  __STDC__
  535. #include "stdlib.h"
  536. #endif
  537. X
  538. /***************************************************************
  539. X
  540. X   dr_draw()
  541. X
  542. X   This function draws the ground track screen.
  543. X   It is called by fo_draw().
  544. X
  545. ***************************************************************/
  546. X
  547. dr_draw( uiwind, redraw_screen, s_start, s_end, pos )
  548. X   struct uiwindow *uiwind;
  549. X   int redraw_screen, pos;
  550. X   struct spj_pt *s_start, *s_end;
  551. X   {
  552. X   register int orbit;
  553. X   int x, y;
  554. X
  555. #ifdef  OLD_DEBUG
  556. X   sprintf( bw_ebuf, "dr_draw(): %d %d %d %d", uiwind->u_x1, uiwind->u_y1,
  557. X      uiwind->u_x2, uiwind->u_y2 );
  558. X   bw_debug( bw_ebuf );
  559. #endif
  560. X
  561. X   bw_message( MAP_DRAW );
  562. X
  563. X   if ( redraw_screen == TRUE )
  564. X      {
  565. X
  566. X      /* Prepare the screen */
  567. X
  568. X      dr_prep( uiwind, pos );
  569. X
  570. X      /* Draw the surface features */
  571. X
  572. X      dr_plot( s_start, s_end, cl_surface, SOLID, pos );
  573. X
  574. X     }
  575. X
  576. X   }
  577. X
  578. /***************************************************************
  579. X
  580. X   dr_prep()
  581. X
  582. X   This routine draws the panel at the bottom of the screen
  583. X   which contains various parameters and is used when the
  584. X   ground track display is in effect.  The routine is called
  585. X   by dr_draw().
  586. X
  587. ***************************************************************/
  588. X
  589. dr_prep( uiwind, pos )
  590. X   struct uiwindow *uiwind;
  591. X   int pos;
  592. X   {
  593. X   register int c;
  594. X   int inc;
  595. X   double x;
  596. X   int x_xmax, x_ymax;
  597. X
  598. X   /***  Blank the entire window user area */
  599. X
  600. X   ui_fbox( uiwind->u_x1, uiwind->u_y1,
  601. X      uiwind->u_x2, uiwind->u_y2, BLACK, SOLID );
  602. X
  603. X   /***  First determine if x or y axis must be scaled */
  604. X
  605. X   x_xmax = uiwind->u_x2 - uiwind->u_x1;
  606. X   x_ymax = uiwind->u_y2 - uiwind->u_y1;
  607. X
  608. X   if ( ( x_xmax / 2 ) >
  609. X    ( ( x_ymax * gr_pysize ) / gr_pxsize )
  610. X      )
  611. X
  612. X      {                              /* TRUE = scale x */
  613. X
  614. #ifdef  OLD_DEBUG
  615. X      bw_debug( "Scaling x" );
  616. #endif
  617. X
  618. X      dr_ysize = x_ymax;
  619. X      dr_xsize = 2 * (( dr_ysize * gr_pysize ) / gr_pxsize );
  620. X
  621. X      /***  Calculate dr_mapedge */
  622. X
  623. X      dr_mapedge = uiwind->u_x1 +
  624. X     ( ( x_xmax - dr_xsize ) / 2 );
  625. X
  626. X      /***  Calculate dr_mapbase */
  627. X
  628. X      dr_mapbase = uiwind->u_y1;
  629. X
  630. X      }
  631. X
  632. X   else                             /* FALSE = scale y */
  633. X      {
  634. X
  635. #ifdef  OLD_DEBUG
  636. X      bw_debug( "Scaling y" );
  637. #endif
  638. X
  639. X      dr_xsize = x_xmax;
  640. X      dr_ysize = (( dr_xsize * gr_pxsize ) / gr_pysize ) / 2;
  641. X
  642. X      /***  Calculate dr_mapedge */
  643. X
  644. X      dr_mapedge = uiwind->u_x1;
  645. X
  646. X      /***  Calculate dr_mapbase */
  647. X
  648. X      dr_mapbase = uiwind->u_y1 +
  649. X     ( ( x_ymax - dr_ysize ) / 2 );
  650. X
  651. X      }
  652. X
  653. X   /***  Draw lines demarcating the display within the window */
  654. X
  655. X   gr_line( GR_PRIMARY, dr_mapedge, dr_mapbase, dr_mapedge,
  656. X      dr_mapbase + dr_ysize, cl_grid, SOLID );
  657. X
  658. X   gr_line( GR_PRIMARY, dr_mapedge + dr_xsize, dr_mapbase,
  659. X      dr_mapedge + dr_xsize, dr_mapbase + dr_ysize,
  660. X      cl_grid, SOLID );
  661. X
  662. X   gr_line( GR_PRIMARY, dr_mapedge, dr_mapbase,
  663. X      dr_mapedge + dr_xsize,
  664. X      dr_mapbase, cl_grid, SOLID );
  665. X
  666. X   gr_line( GR_PRIMARY, dr_mapedge, dr_mapbase + dr_ysize,
  667. X      dr_mapedge + dr_xsize, dr_mapbase + dr_ysize,
  668. X      cl_grid, SOLID );
  669. X
  670. #ifdef  OLD_DEBUG
  671. X   sprintf( bw_ebuf, "x_size %d, y_size %d, mapedge %d, mapbase %d",
  672. X      dr_xsize, dr_ysize, dr_mapedge, dr_mapbase );
  673. X   bw_debug( bw_ebuf );
  674. #endif
  675. X
  676. X   /***  Now draw the latitude and longitude lines. We must draw
  677. X     only a quarter of a line at a time, or dr_line will
  678. X     reject the request. */
  679. X
  680. X   for ( x = -75.0; x < 90.0; x += 15.0 )               /* latitudes */
  681. X      {
  682. X      dr_line( x, -180.0, x, -90.0, cl_grid, GRID, pos );
  683. X      dr_line( x,  -90.0, x,   0.0, cl_grid, GRID, pos );
  684. X      dr_line( x,    0.0, x,  90.0, cl_grid, GRID, pos );
  685. X      dr_line( x,   90.0, x, 180.0, cl_grid, GRID, pos );
  686. X      }
  687. X
  688. X   for ( x = -165.0; x < 180.0; x += 15.0 )             /* longitudes */
  689. X      {
  690. X      dr_line( -90.0, x, -45.0, x, cl_grid, GRID, pos );
  691. X      dr_line( -45.0, x,   0.0, x, cl_grid, GRID, pos );
  692. X      dr_line(   0.0, x,  45.0, x, cl_grid, GRID, pos );
  693. X      dr_line(  45.0, x,  90.0, x, cl_grid, GRID, pos );
  694. X      }
  695. X
  696. #ifdef  OLD_DEBUG
  697. X   bw_debug( "end of dr_prep() " );
  698. #endif
  699. X
  700. X   }
  701. X
  702. /***************************************************************
  703. X
  704. X   dr_plot()
  705. X
  706. X   This routine plots a set of coordinates on the ground
  707. X   track map.  It is called by dr_draw().
  708. X
  709. ***************************************************************/
  710. X
  711. dr_plot( start, end, color, style, pos )
  712. X   struct spj_pt *start, *end;
  713. X   int color, style, pos;
  714. X   {
  715. X   struct spj_pt *current;
  716. X   double prevx, prevy;
  717. X
  718. X   current = start->next;
  719. X
  720. #ifdef  OLD_DEBUG
  721. X   bw_debug( "DEBUG:  Plotting" );
  722. #endif
  723. X
  724. X   prevx = current->longitude;
  725. X   prevy = current->latitude;
  726. X   while ( current != end )
  727. X      {
  728. X      if ( current->code < 1000 )
  729. X     {
  730. X     dr_line( current->latitude, current->longitude,
  731. X        prevy, prevx, color, style, pos );
  732. X     }
  733. X      prevx = current->longitude;
  734. X      prevy = current->latitude;
  735. X      current = current->next;
  736. X      }
  737. X
  738. #ifdef  OLD_DEBUG
  739. X   bw_message( " " );
  740. #endif
  741. X   }
  742. X
  743. /***************************************************************
  744. X
  745. X   dr_line()
  746. X
  747. X   This routine draws a single line on the ground
  748. X   track map.
  749. X
  750. ***************************************************************/
  751. X
  752. dr_line( fromlat, fromlon, tolat, tolon, color, style, pos )
  753. X   double fromlat, fromlon, tolat, tolon;
  754. X   int color, style, pos;
  755. X   {
  756. X   int x1, y1, x2, y2;
  757. X
  758. X   if ( ( fromlat < map_pos[ pos ][ 1 ] ) || ( fromlat > map_pos[ pos ][ 3 ] ))
  759. X      {
  760. X      /* sprintf( bw_ebuf, "dr_line received from latitude %.2lf", fromlat );
  761. X      bw_error( bw_ebuf ); */
  762. X      return BW_ERROR;
  763. X      }
  764. X   if ( ( tolat < map_pos[ pos ][ 1 ] ) || ( tolat > map_pos[ pos ][ 3 ] ))
  765. X      {
  766. X      /* sprintf( bw_ebuf, "dr_line received to latitude %.2lf", tolat );
  767. X      bw_error( bw_ebuf ); */
  768. X      return BW_ERROR;
  769. X      }
  770. X   if ( ( fromlon < map_pos[ pos ][ 0 ] ) || ( fromlon > map_pos[ pos ][ 2 ] ))
  771. X      {
  772. X      /* sprintf( bw_ebuf, "dr_line received from longitude %.2lf", fromlon );
  773. X      bw_error( bw_ebuf ); */
  774. X      return BW_ERROR;
  775. X      }
  776. X   if ( ( tolon < map_pos[ pos ][ 0 ] ) || ( tolon > map_pos[ pos ][ 2 ] ))
  777. X      {
  778. X      /* sprintf( bw_ebuf, "dr_line received to longitude %.2lf", tolon );
  779. X      bw_error( bw_ebuf ); */
  780. X      return BW_ERROR;
  781. X      }
  782. X
  783. #ifdef  OLD_DEBUG
  784. X   sprintf( bw_ebuf, "DEBUG from x = %.2lf, from y = %.2lf, to x = %.2lf, to y = %.2lf, color = %d, style = %d,",
  785. X      fromlon,
  786. X      fromlat,
  787. X      tolon,
  788. X      tolat,
  789. X      color, style );
  790. X   bw_debug( bw_ebuf );
  791. #endif
  792. X
  793. X   x1 = (( fromlon - (double) ( map_pos[ pos ][ 0 ] ) )
  794. X      * ( (double) dr_xsize / ( map_pos[ pos ][ 2 ] - (double) map_pos[ pos ][ 0 ] ) ));
  795. X   x2 = ((   tolon - (double) ( map_pos[ pos ][ 0 ] ) )
  796. X      * ( (double) dr_xsize / ( map_pos[ pos ][ 2 ] - (double) map_pos[ pos ][ 0 ] ) ));
  797. X
  798. X   if ( abs( x1 - x2 ) > ( ( dr_xsize / 2 ) + 3 ) )
  799. X      {
  800. #ifdef  OLD_DEBUG
  801. X      sprintf( sfs_tbuf, "DEBUG: dr_line() failed: x1 = %d, x2 = %d",
  802. X     x1, x2 );
  803. X      bw_debug( sfs_tbuf );
  804. X      sprintf( sfs_tbuf, "DEBUG: dr_line() #2: abs() = %d, dr_xsize = %d, dr_xsize / 3 = %d",
  805. X     abs( x1 - x2), dr_xsize, (dr_xsize / 3) );
  806. X      bw_debug( sfs_tbuf );
  807. #endif
  808. X      return;
  809. X      }
  810. X
  811. X   y1 = (( fromlat - (double) ( map_pos[ pos ][ 1 ] ))
  812. X      * ( (double) dr_ysize / ( map_pos[ pos ][ 3 ] - (double) map_pos[ pos ][ 1 ] ) ));
  813. X   y2 = ((   tolat - (double) ( map_pos[ pos ][ 1 ]  ))
  814. X      * ( (double) dr_ysize / ( map_pos[ pos ][ 3 ] - (double) map_pos[ pos ][ 1 ] ) ));
  815. X
  816. X   if ( abs( y1 - y2 ) > ( ( dr_ysize / 2 ) + 3 ) )
  817. X      {
  818. #ifdef  OLD_DEBUG
  819. X      sprintf( sfs_tbuf, "dr_line() failed: y1 = %d, y2 = %d",
  820. X     y1, y2 );
  821. X      bw_debug( sfs_tbuf );
  822. #endif
  823. X      return;
  824. X      }
  825. X
  826. #ifdef  OLD_DEBUG
  827. X   sprintf( sfs_tbuf, "DEBUG x1 = %d, y1 = %d, x2 = %d, y2 = %d, color = %d, style = %d,",
  828. X      dr_mapedge + x1,
  829. X      dr_mapbase + y1,
  830. X      dr_mapedge + x2,
  831. X      dr_mapbase + y2,
  832. X      color, style );
  833. X   bw_debug( sfs_tbuf );
  834. #endif
  835. X
  836. X   gr_line( GR_PRIMARY,
  837. X      dr_mapedge + x1,
  838. X      dr_mapbase + y1,
  839. X      dr_mapedge + x2,
  840. X      dr_mapbase + y2,
  841. X      color, style );
  842. X   }
  843. X
  844. SHAR_EOF
  845. chmod 0644 sfs/map/map_dr.c ||
  846. echo 'restore of sfs/map/map_dr.c failed'
  847. Wc_c="`wc -c < 'sfs/map/map_dr.c'`"
  848. test 9366 -eq "$Wc_c" ||
  849.     echo 'sfs/map/map_dr.c: original size 9366, current size' "$Wc_c"
  850. rm -f _shar_wnt_.tmp
  851. fi
  852. # ============= sfs/map/test.spd ==============
  853. if test -f 'sfs/map/test.spd' -a X"$1" != X"-c"; then
  854.     echo 'x - skipping sfs/map/test.spd (File already exists)'
  855.     rm -f _shar_wnt_.tmp
  856. else
  857. > _shar_wnt_.tmp
  858. echo 'x - extracting sfs/map/test.spd (Text)'
  859. sed 's/^X//' << 'SHAR_EOF' > 'sfs/map/test.spd' &&
  860. ;    test.spd
  861. ;
  862. ;    test (blank) SPD map for SFS MAP utility
  863. ;
  864. 1001    0.0    0.0    0.0
  865. SHAR_EOF
  866. chmod 0644 sfs/map/test.spd ||
  867. echo 'restore of sfs/map/test.spd failed'
  868. Wc_c="`wc -c < 'sfs/map/test.spd'`"
  869. test 75 -eq "$Wc_c" ||
  870.     echo 'sfs/map/test.spd: original size 75, current size' "$Wc_c"
  871. rm -f _shar_wnt_.tmp
  872. fi
  873. # ============= sfs/sfs/buildsfs.bat ==============
  874. if test ! -d 'sfs/sfs'; then
  875.     echo 'x - creating directory sfs/sfs'
  876.     mkdir 'sfs/sfs'
  877. fi
  878. if test -f 'sfs/sfs/buildsfs.bat' -a X"$1" != X"-c"; then
  879.     echo 'x - skipping sfs/sfs/buildsfs.bat (File already exists)'
  880.     rm -f _shar_wnt_.tmp
  881. else
  882. > _shar_wnt_.tmp
  883. echo 'x - extracting sfs/sfs/buildsfs.bat (Text)'
  884. sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/buildsfs.bat' &&
  885. @echo off
  886. cls
  887. echo BUILD SPACE FLIGHT SIMULATOR
  888. echo ----------------------------
  889. echo This Script will lead you through the process of building
  890. echo the Space Flight Simulator on a PC-compatible microcomputer
  891. echo utilizing the Microsoft QuickC (tm) compiler.  The script
  892. echo presupposes that you have already installed all of the program
  893. echo and source code files in the appropriate subdirectories (see
  894. echo the sfs manual and the README file supplied with the source
  895. echo code), and that you have built the Bywater Graphical User
  896. echo Interface).  If you do not have Microsoft QuickC, this script is
  897. echo useless, and you should exit now by hitting CONTROL-C. 
  898. pause
  899. echo BUILD SFS PROGRAM LOADER
  900. echo ------------------------
  901. copy ..\as\as.h ..\..\include
  902. nmake -f sfs.mak
  903. echo BUILD SFS ORBITAL MODELING MODULE
  904. echo ---------------------------------
  905. nmake -f sfsm_n.mak
  906. echo BUILD SFS ORBITAL SIMULATION MODULE
  907. echo -----------------------------------
  908. nmake -f sfsx_n.mak
  909. echo Copying program files to sfs\bin area...
  910. copy sfs.exe ..\bin
  911. copy sfsm.exe ..\bin\sfsm.app
  912. copy sfsx.exe ..\bin\sfsx.app
  913. echo PROGRAM IS NOW COMPLETE
  914. echo -----------------------
  915. echo The script will now proceed to execute the Space Flight Simulator.
  916. echo If you do not wish to do so, exit now by hitting CONTROL-C.
  917. pause
  918. cd ..\bin
  919. sfs
  920. SHAR_EOF
  921. chmod 0644 sfs/sfs/buildsfs.bat ||
  922. echo 'restore of sfs/sfs/buildsfs.bat failed'
  923. Wc_c="`wc -c < 'sfs/sfs/buildsfs.bat'`"
  924. test 1320 -eq "$Wc_c" ||
  925.     echo 'sfs/sfs/buildsfs.bat: original size 1320, current size' "$Wc_c"
  926. rm -f _shar_wnt_.tmp
  927. fi
  928. # ============= sfs/sfs/buildsfs.sh ==============
  929. if test -f 'sfs/sfs/buildsfs.sh' -a X"$1" != X"-c"; then
  930.     echo 'x - skipping sfs/sfs/buildsfs.sh (File already exists)'
  931.     rm -f _shar_wnt_.tmp
  932. else
  933. > _shar_wnt_.tmp
  934. echo 'x - extracting sfs/sfs/buildsfs.sh (Text)'
  935. sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/buildsfs.sh' &&
  936. # buildsfs.sh    build script for Space Flight Simulator, ver. 1.00
  937. #
  938. # set the following to your base directory for SFS sources,
  939. # i.e., the directory from which sfs and io are both subdirectories
  940. #
  941. clear
  942. echo Build Space Flight Simulator ver. 1.00
  943. echo --------------------------------------
  944. echo
  945. echo This script should be placed in the top directory for SFS
  946. echo sources, i.e., in the directory from which both io and 
  947. echo sfs are subdirectories. It allows SFS to be built on the 
  948. echo AT\&T Unix PC utilizing either TAM or MGR, or on a 
  949. echo computer using the X Windows system. 
  950. echo
  951. echo Select system to build: 
  952. echo
  953. echo "    1  AT&T Unix PC using TAM"
  954. echo "    2  AT&T Unix PC using MGR"
  955. echo "    3  X Windows"
  956. echo
  957. echo "Press a key and RETURN: "
  958. echo
  959. read NUMBER
  960. echo
  961. X
  962. if [ "$NUMBER" -eq 1 ]
  963. X    then
  964. X           echo "Building for AT&T Unix PC using TAM"
  965. X           cp makefile.tam makefile
  966. X
  967. else if [ "$NUMBER" -eq 2 ]
  968. X    then
  969. X           echo "Building for AT&T Unix PC using MGR"
  970. X           cp makefile.mgr makefile
  971. X
  972. else if [ "$NUMBER" -eq 3 ]
  973. X    then
  974. X           echo "Building for X Windows"
  975. X           cp makefile.x makefile
  976. X
  977. X        else
  978. X           echo Choice not supported.
  979. X           exit 1
  980. X
  981. X     fi
  982. X     fi
  983. fi
  984. X
  985. echo copying as header...
  986. cp ../as/as.h ../../include
  987. echo copying bitmaps for runtime modules
  988. cp ../../io/ui/*.pbm ../bin
  989. X
  990. echo
  991. echo
  992. echo Building SFS programs...
  993. make all
  994. X
  995. echo
  996. echo Program is complete.
  997. X
  998. #
  999. #    end of buildsfs.sh
  1000. SHAR_EOF
  1001. chmod 0644 sfs/sfs/buildsfs.sh ||
  1002. echo 'restore of sfs/sfs/buildsfs.sh failed'
  1003. Wc_c="`wc -c < 'sfs/sfs/buildsfs.sh'`"
  1004. test 1455 -eq "$Wc_c" ||
  1005.     echo 'sfs/sfs/buildsfs.sh: original size 1455, current size' "$Wc_c"
  1006. rm -f _shar_wnt_.tmp
  1007. fi
  1008. # ============= sfs/sfs/cleansfs.bat ==============
  1009. if test -f 'sfs/sfs/cleansfs.bat' -a X"$1" != X"-c"; then
  1010.     echo 'x - skipping sfs/sfs/cleansfs.bat (File already exists)'
  1011.     rm -f _shar_wnt_.tmp
  1012. else
  1013. > _shar_wnt_.tmp
  1014. echo 'x - extracting sfs/sfs/cleansfs.bat (Text)'
  1015. sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/cleansfs.bat' &&
  1016. @echo off
  1017. rem ------------------------------------------------------------
  1018. rem File cleansfs.bat    - clean up SFS directories
  1019. rem ------------------------------------------------------------
  1020. erase ..\bin\*.fon
  1021. erase ..\as\*.obj
  1022. erase ..\as\*.crf
  1023. erase ..\as\*.exe
  1024. erase ..\as\*.ini
  1025. erase ..\sfs\*.obj
  1026. erase ..\sfs\*.crf
  1027. erase ..\sfs\*.exe
  1028. erase ..\sfs\*.ini
  1029. erase ..\map\*.obj
  1030. erase ..\map\*.exe
  1031. erase ..\map\*.crf
  1032. erase ..\map\*.ini
  1033. erase ..\map\*.fon
  1034. erase ..\bin\*.exe
  1035. erase ..\bin\*.app
  1036. SHAR_EOF
  1037. chmod 0644 sfs/sfs/cleansfs.bat ||
  1038. echo 'restore of sfs/sfs/cleansfs.bat failed'
  1039. Wc_c="`wc -c < 'sfs/sfs/cleansfs.bat'`"
  1040. test 489 -eq "$Wc_c" ||
  1041.     echo 'sfs/sfs/cleansfs.bat: original size 489, current size' "$Wc_c"
  1042. rm -f _shar_wnt_.tmp
  1043. fi
  1044. # ============= sfs/sfs/cleansfs.sh ==============
  1045. if test -f 'sfs/sfs/cleansfs.sh' -a X"$1" != X"-c"; then
  1046.     echo 'x - skipping sfs/sfs/cleansfs.sh (File already exists)'
  1047.     rm -f _shar_wnt_.tmp
  1048. else
  1049. > _shar_wnt_.tmp
  1050. echo 'x - extracting sfs/sfs/cleansfs.sh (Text)'
  1051. sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/cleansfs.sh' &&
  1052. #    clean.sh    clean up SFS directories
  1053. #
  1054. # set the following to your base directory for SFS sources,
  1055. # i.e., the directory from which sfs and io are both subdirectories
  1056. #
  1057. #
  1058. X
  1059. rm makefile
  1060. rm *.o
  1061. rm ../bin/*.app
  1062. rm ../bin/sfs
  1063. rm ../bin/*.pbm
  1064. rm ../../include/as.h
  1065. #
  1066. #    end of clean.sh
  1067. X
  1068. SHAR_EOF
  1069. chmod 0644 sfs/sfs/cleansfs.sh ||
  1070. echo 'restore of sfs/sfs/cleansfs.sh failed'
  1071. Wc_c="`wc -c < 'sfs/sfs/cleansfs.sh'`"
  1072. test 279 -eq "$Wc_c" ||
  1073.     echo 'sfs/sfs/cleansfs.sh: original size 279, current size' "$Wc_c"
  1074. rm -f _shar_wnt_.tmp
  1075. fi
  1076. # ============= sfs/sfs/makefile.mgr ==============
  1077. if test -f 'sfs/sfs/makefile.mgr' -a X"$1" != X"-c"; then
  1078.     echo 'x - skipping sfs/sfs/makefile.mgr (File already exists)'
  1079.     rm -f _shar_wnt_.tmp
  1080. else
  1081. > _shar_wnt_.tmp
  1082. echo 'x - extracting sfs/sfs/makefile.mgr (Text)'
  1083. sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/makefile.mgr' &&
  1084. #---------------------------------------------------------------
  1085. #
  1086. #    Unix Makefile for Space Flight Simulator
  1087. #
  1088. #    AT&T Unix PC (tm) using MGR (tm) interface
  1089. #
  1090. #---------------------------------------------------------------
  1091. X
  1092. #---------------------------------------------------------------
  1093. # Flags for all modules
  1094. X
  1095. CFLAGS=        -DDEBUG -O -I../../include
  1096. X
  1097. #---------------------------------------------------------------
  1098. # user interface and astronomy object files
  1099. X
  1100. LIBS=        ../../lib/ui_boxes.o ../../lib/ui_dial.o \
  1101. X        ../../lib/ui_init.o ../../lib/ui_list.o ../../lib/ui_text.o \
  1102. X        ../../lib/ui_gets.o \
  1103. X        ../../lib/gr_mgr.o \
  1104. X                ../../lib/dr_sysv.o ../../lib/kb_7300.o\
  1105. X        ../as/as_orbit.o ../as/as_focus.o ../as/as_vpt.o \
  1106. X        ../as/as_spj.o
  1107. X
  1108. #---------------------------------------------------------------
  1109. # Common object files
  1110. X
  1111. COMM=        sfs_pr.o sfs_pe.o
  1112. X
  1113. #---------------------------------------------------------------
  1114. # Modeling module object files
  1115. X
  1116. SFSM=        sfsm.o sfsm_om.o
  1117. X
  1118. #---------------------------------------------------------------
  1119. # Simulation module object files
  1120. X
  1121. SFSX=        sfsx.o sfsx_cp.o \
  1122. X        sfsx_sp.o sfsx_var.o \
  1123. X        sfs_ft.o sfs_gt.o \
  1124. X        sfs_di.o sfs_vi.o
  1125. X
  1126. #---------------------------------------------------------------
  1127. # Build all modules
  1128. X
  1129. all:        sfs sfsm sfsx
  1130. X
  1131. #---------------------------------------------------------------
  1132. # Build the program loader
  1133. X
  1134. sfs:        sfs.o
  1135. X        $(CC) -O sfs.o -o sfs
  1136. X        mv sfs ../bin
  1137. X
  1138. #---------------------------------------------------------------
  1139. # Build the modeling module
  1140. X
  1141. sfsm:        $(SFSM) $(COMM)
  1142. X        $(CC) $(SFSM) $(COMM) $(LIBS)\
  1143. X                -lmgr -lm -o sfsm.app
  1144. X        mv sfsm.app ../bin
  1145. X
  1146. #---------------------------------------------------------------
  1147. # Build the simulation module
  1148. X
  1149. sfsx:        $(SFSX) $(COMM)
  1150. X        $(CC) $(SFSX) $(COMM) $(LIBS)\
  1151. X                -lmgr -lm -o sfsx.app
  1152. X        mv sfsx.app ../bin
  1153. X
  1154. #---------------------------------------------------------------
  1155. # End of makefile.mgr
  1156. #---------------------------------------------------------------
  1157. SHAR_EOF
  1158. chmod 0644 sfs/sfs/makefile.mgr ||
  1159. echo 'restore of sfs/sfs/makefile.mgr failed'
  1160. Wc_c="`wc -c < 'sfs/sfs/makefile.mgr'`"
  1161. test 2007 -eq "$Wc_c" ||
  1162.     echo 'sfs/sfs/makefile.mgr: original size 2007, current size' "$Wc_c"
  1163. rm -f _shar_wnt_.tmp
  1164. fi
  1165. # ============= sfs/sfs/makefile.tam ==============
  1166. if test -f 'sfs/sfs/makefile.tam' -a X"$1" != X"-c"; then
  1167.     echo 'x - skipping sfs/sfs/makefile.tam (File already exists)'
  1168.     rm -f _shar_wnt_.tmp
  1169. else
  1170. > _shar_wnt_.tmp
  1171. echo 'x - extracting sfs/sfs/makefile.tam (Text)'
  1172. sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/makefile.tam' &&
  1173. #---------------------------------------------------------------
  1174. #
  1175. #    Unix Makefile for Space Flight Simulator
  1176. #
  1177. #    AT&T Unix PC (tm) using TAM library
  1178. #
  1179. #---------------------------------------------------------------
  1180. X
  1181. #---------------------------------------------------------------
  1182. # Flags for all modules
  1183. X
  1184. CFLAGS=        -DDEBUG -O -I../../include
  1185. X
  1186. #---------------------------------------------------------------
  1187. # user interface and astronomy object files
  1188. X
  1189. LIBS=        ../../lib/ui_boxes.o ../../lib/ui_dial.o \
  1190. X        ../../lib/ui_init.o ../../lib/ui_list.o ../../lib/ui_text.o \
  1191. X        ../../lib/ui_gets.o \
  1192. X        ../../lib/gr_tam.o ../../lib/gr_def.o\
  1193. X                ../../lib/dr_sysv.o ../../lib/kb_tam.o\
  1194. X        ../as/as_orbit.o ../as/as_focus.o ../as/as_vpt.o \
  1195. X        ../as/as_spj.o
  1196. X
  1197. #---------------------------------------------------------------
  1198. # Common object files
  1199. X
  1200. COMM=        sfs_pr.o sfs_pe.o
  1201. X
  1202. #---------------------------------------------------------------
  1203. # Modeling module object files
  1204. X
  1205. SFSM=        sfsm.o sfsm_om.o
  1206. X
  1207. #---------------------------------------------------------------
  1208. # Simulation module object files
  1209. X
  1210. SFSX=        sfsx.o sfsx_cp.o \
  1211. X        sfsx_sp.o sfsx_var.o \
  1212. X        sfs_ft.o sfs_gt.o \
  1213. X        sfs_di.o sfs_vi.o
  1214. X
  1215. #---------------------------------------------------------------
  1216. # Build all modules
  1217. X
  1218. all:        sfs sfsm sfsx
  1219. X
  1220. #---------------------------------------------------------------
  1221. # Build the program loader
  1222. X
  1223. sfs:        sfs.o
  1224. X        $(CC) -O sfs.o -o sfs
  1225. X        mv sfs ../bin
  1226. X
  1227. #---------------------------------------------------------------
  1228. # Build the modeling module
  1229. X
  1230. sfsm:        $(SFSM) $(COMM)
  1231. X        $(CC) $(SFSM) $(COMM) $(LIBS)\
  1232. X                -ltam -ltermcap -lm -o sfsm.app
  1233. X        mv sfsm.app ../bin
  1234. X
  1235. #---------------------------------------------------------------
  1236. # Build the simulation module
  1237. X
  1238. sfsx:        $(SFSX) $(COMM)
  1239. X        $(CC) $(SFSX) $(COMM) $(LIBS)\
  1240. X                -ltam -ltermcap -lm -o sfsx.app
  1241. X        mv sfsx.app ../bin
  1242. X
  1243. #---------------------------------------------------------------
  1244. # End of makefile.tam
  1245. #---------------------------------------------------------------
  1246. SHAR_EOF
  1247. chmod 0644 sfs/sfs/makefile.tam ||
  1248. echo 'restore of sfs/sfs/makefile.tam failed'
  1249. Wc_c="`wc -c < 'sfs/sfs/makefile.tam'`"
  1250. test 2037 -eq "$Wc_c" ||
  1251.     echo 'sfs/sfs/makefile.tam: original size 2037, current size' "$Wc_c"
  1252. rm -f _shar_wnt_.tmp
  1253. fi
  1254. # ============= sfs/sfs/makefile.x ==============
  1255. if test -f 'sfs/sfs/makefile.x' -a X"$1" != X"-c"; then
  1256.     echo 'x - skipping sfs/sfs/makefile.x (File already exists)'
  1257.     rm -f _shar_wnt_.tmp
  1258. else
  1259. > _shar_wnt_.tmp
  1260. echo 'x - extracting sfs/sfs/makefile.x (Text)'
  1261. sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/makefile.x' &&
  1262. #---------------------------------------------------------------
  1263. #
  1264. #    Unix Makefile for Space Flight Simulator
  1265. #
  1266. #    X11 Implementation
  1267. #
  1268. #---------------------------------------------------------------
  1269. X
  1270. #---------------------------------------------------------------
  1271. # Flags for all modules
  1272. X
  1273. CFLAGS=        -DDEBUG -O -I../../include
  1274. X
  1275. #---------------------------------------------------------------
  1276. # user interface and astronomy object files
  1277. X
  1278. LIBS=        ../../lib/ui_boxes.o ../../lib/ui_dial.o \
  1279. X        ../../lib/ui_init.o ../../lib/ui_list.o ../../lib/ui_text.o \
  1280. X        ../../lib/ui_gets.o ../../lib/ui_pbm.o \
  1281. X        ../../lib/gr_x.o \
  1282. X                ../../lib/dr_unix.o ../../lib/kb_x.o
  1283. X
  1284. AST=        as_orbit.o as_focus.o as_vpt.o \
  1285. X        as_spj.o
  1286. X
  1287. #---------------------------------------------------------------
  1288. # Common object files
  1289. X
  1290. COMM=        sfs_pr.o sfs_pe.o
  1291. X
  1292. #---------------------------------------------------------------
  1293. # Modeling module object files
  1294. X
  1295. SFSM=        sfsm.o sfsm_om.o
  1296. X
  1297. #---------------------------------------------------------------
  1298. # Simulation module object files
  1299. X
  1300. SFSX=        sfsx.o sfsx_cp.o \
  1301. X        sfsx_sp.o sfsx_var.o \
  1302. X        sfs_ft.o sfs_gt.o \
  1303. X        sfs_di.o sfs_vi.o
  1304. X
  1305. #---------------------------------------------------------------
  1306. # Build all modules
  1307. X
  1308. all:        sfs sfsm sfsx
  1309. X
  1310. #---------------------------------------------------------------
  1311. # Build the program loader
  1312. X
  1313. sfs:        sfs.o
  1314. X        $(CC) -O sfs.o -o sfs
  1315. X        mv sfs ../bin
  1316. X
  1317. #---------------------------------------------------------------
  1318. # Build the modeling module
  1319. X
  1320. sfsm:        $(SFSM) $(COMM) $(AST) 
  1321. X        $(CC) $(SFSM) $(COMM) $(LIBS) $(AST) \
  1322. X                -lX11 -lm -o sfsm.app
  1323. X        mv sfsm.app ../bin
  1324. X
  1325. #---------------------------------------------------------------
  1326. # Build the simulation module
  1327. X
  1328. sfsx:        $(SFSX) $(COMM) $(AST) 
  1329. X        $(CC) $(SFSX) $(COMM) $(LIBS) $(AST) \
  1330. X                -lX11 -lm -o sfsx.app
  1331. X        mv sfsx.app ../bin
  1332. X
  1333. #--------------------------------------------------------------
  1334. # astronomical subroutines dependencies
  1335. X
  1336. as_orbit.o:
  1337. X        $(CC) $(CFLAGS) -c ../as/as_orbit.c
  1338. X
  1339. as_focus.o:
  1340. X        $(CC) $(CFLAGS) -c ../as/as_focus.c
  1341. X
  1342. as_vpt.o:
  1343. X        $(CC) $(CFLAGS) -c ../as/as_vpt.c
  1344. X
  1345. as_spj.o:
  1346. X        $(CC) $(CFLAGS) -c ../as/as_spj.c
  1347. X
  1348. #---------------------------------------------------------------
  1349. # End of makefile.x
  1350. #---------------------------------------------------------------
  1351. SHAR_EOF
  1352. chmod 0644 sfs/sfs/makefile.x ||
  1353. echo 'restore of sfs/sfs/makefile.x failed'
  1354. Wc_c="`wc -c < 'sfs/sfs/makefile.x'`"
  1355. test 2308 -eq "$Wc_c" ||
  1356.     echo 'sfs/sfs/makefile.x: original size 2308, current size' "$Wc_c"
  1357. rm -f _shar_wnt_.tmp
  1358. fi
  1359. # ============= sfs/sfs/sfs.c ==============
  1360. if test -f 'sfs/sfs/sfs.c' -a X"$1" != X"-c"; then
  1361.     echo 'x - skipping sfs/sfs/sfs.c (File already exists)'
  1362.     rm -f _shar_wnt_.tmp
  1363. else
  1364. > _shar_wnt_.tmp
  1365. echo 'x - extracting sfs/sfs/sfs.c (Text)'
  1366. sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/sfs.c' &&
  1367. /***************************************************************
  1368. X
  1369. X    sfs.c           Space Flight Simulator
  1370. X            Loader Program
  1371. X
  1372. X            Copyright (c) 1991, Ted A. Campbell
  1373. X
  1374. X            Bywater Software
  1375. X            P. O. Box 4023 
  1376. X            Duke Station 
  1377. X            Durham, NC  27706
  1378. X
  1379. X            email: tcamp@hercules.acpub.duke.edu
  1380. X
  1381. X    Copyright and Permissions Information:
  1382. X
  1383. X    All U.S. and international copyrights are claimed by the
  1384. X    author. The author grants permission to use this code
  1385. X    and software based on it under the following conditions:
  1386. X    (a) in general, the code and software based upon it may be 
  1387. X    used by individuals and by non-profit organizations; (b) it
  1388. X    may also be utilized by governmental agencies in any country,
  1389. X    with the exception of military agencies; (c) the code and/or
  1390. X    software based upon it may not be sold for a profit without
  1391. X    an explicit and specific permission from the author, except
  1392. X    that a minimal fee may be charged for media on which it is
  1393. X    copied, and for copying and handling; (d) the code must be 
  1394. X    distributed in the form in which it has been released by the
  1395. X    author; and (e) the code and software based upon it may not 
  1396. X    be used for illegal activities. 
  1397. X
  1398. ***************************************************************/
  1399. X
  1400. #include "stdio.h"
  1401. #include "string.h"
  1402. #ifdef    __STDC__
  1403. #include "process.h"
  1404. #include "stdlib.h"
  1405. #endif
  1406. #include "ctype.h"
  1407. X
  1408. #include "as.h"
  1409. #include "sfs.h"
  1410. X
  1411. #ifndef __STDC__
  1412. #define    size_t    int
  1413. #endif
  1414. X
  1415. /* #define SPAWN */
  1416. X
  1417. #define PROGBUFSIZE     64
  1418. X
  1419. char    sfs_program[ PROGBUFSIZE ];
  1420. char    sfs_tbuf[ 128 ];
  1421. X
  1422. #ifdef  SPAWN
  1423. char    arguments[ 5 ][ 64 ];
  1424. #endif
  1425. X
  1426. main( argc, argv )
  1427. X   int argc;
  1428. X   char **argv;
  1429. X   {
  1430. X   FILE *data;
  1431. X   register int y, t;
  1432. X   int n;
  1433. X
  1434. X   strcpy( sfs_program, SFS_DEFAULTPROG );
  1435. X   if ( argc > 1 )
  1436. X      {
  1437. #ifdef  OLD_DEBUG
  1438. X      fprintf( stderr, "Argument <%s>\n", argv[ 1 ] );
  1439. X      getchar();
  1440. #endif
  1441. X      strcpy( sfs_program, argv[ 1 ] );
  1442. X      }
  1443. X
  1444. #ifdef  SPAWN
  1445. X   y = spawnl( P_WAIT, SFSCH_MODEL, SFSCH_MODEL, sfs_program, NULL );
  1446. #else
  1447. X   sprintf ( sfs_tbuf, "%s %s ", SFSCH_MODEL, sfs_program );
  1448. #ifdef  OLD_DEBUG
  1449. X   fprintf( stderr, "SFS DEBUG: Ready to execute <%s> \n", sfs_tbuf );
  1450. X   getchar();
  1451. #endif
  1452. X   y = system( sfs_tbuf );
  1453. #endif
  1454. X
  1455. #ifdef  OLD_DEBUG
  1456. X   fprintf( stderr, "y = %d \n", y );
  1457. X   getchar();
  1458. #endif
  1459. X
  1460. X   if ( y == -1 )
  1461. X      {
  1462. X      printf( SFS_LINKERR );
  1463. X      perror( ERR_LTITLE );
  1464. X      return;
  1465. X      }
  1466. X
  1467. X   while( y != -1 )
  1468. X      {
  1469. X      if ( ( data = fopen( SFS_CHAINFN, "r" ) ) != NULL )
  1470. X     {
  1471. X     fgets( sfs_program, PROGBUFSIZE, data );
  1472. X     fclose( data );
  1473. X
  1474. #ifdef  OLD_DEBUG
  1475. X     fprintf( stderr, "DEBUG: read program <%s>\n", sfs_program );
  1476. X     getchar();
  1477. #endif
  1478. X
  1479. X     if ( strncmp( sfs_program, SFS_EXITARG, (size_t) 4 ) == 0 )
  1480. X        {
  1481. X        unlink( SFS_CHAINFN );
  1482. X        return;
  1483. X        }
  1484. X     }
  1485. X      else
  1486. X     {
  1487. X     fprintf( stderr, SFS_CHERR, sfs_program );
  1488. X     return -1;
  1489. X     }
  1490. X
  1491. #ifdef  SPAWN
  1492. X      n = sfs_split( sfs_program );
  1493. X
  1494. #ifdef  OLD_DEBUG
  1495. X      fprintf( stderr, "sfs_split() returned %d arguments\n", n );
  1496. #endif
  1497. X
  1498. X      switch( n )
  1499. X     {
  1500. X     case 1:
  1501. #ifdef  OLD_DEBUG
  1502. X        fprintf( stderr, " <%s> \n", arguments[ 0 ] );
  1503. X        getchar();
  1504. #endif
  1505. X        y = spawnl( P_WAIT, arguments[ 0 ],
  1506. X           arguments[ 0 ], NULL );
  1507. X        break;
  1508. X     case 2:
  1509. #ifdef  OLD_DEBUG
  1510. X        fprintf( stderr, " <%s> <%s> \n", arguments[ 0 ],
  1511. X           arguments[ 1 ] );
  1512. X        getchar();
  1513. #endif
  1514. X        y = spawnl( P_WAIT, arguments[ 0 ], arguments[ 0 ],
  1515. X           arguments[ 1 ], NULL );
  1516. X        break;
  1517. X     case 3:
  1518. #ifdef  OLD_DEBUG
  1519. X        fprintf( stderr, " <%s> <%s> <%s> \n", arguments[ 0 ],
  1520. X           arguments[ 1 ], arguments[ 2 ] );
  1521. X        getchar();
  1522. #endif
  1523. X        y = spawnl( P_WAIT, arguments[ 0 ],
  1524. X           arguments[ 0 ], arguments[ 1 ],
  1525. X           arguments[ 2 ], NULL );
  1526. X        break;
  1527. X
  1528. X     }
  1529. #else
  1530. #ifdef  OLD_DEBUG
  1531. X        fprintf( stderr, " SFS: Ready to execute <%s> \n", sfs_program );
  1532. X        getchar();
  1533. #endif
  1534. X      y = system( sfs_program );
  1535. #endif
  1536. X      }
  1537. X
  1538. X   perror( ERR_TTITLE );
  1539. X   }
  1540. X
  1541. #ifdef  SPAWN
  1542. sfs_split( s )
  1543. X   char *s;
  1544. X   {
  1545. X   int c, d;
  1546. X   char *p;
  1547. X
  1548. X   /* eat up leading whitespace */
  1549. X
  1550. X   p = s;
  1551. X   while ( isspace ( *p ))
  1552. X      {
  1553. X      ++p;
  1554. X      }
  1555. X
  1556. X   /* now read each argument until end of the string */
  1557. X
  1558. X   c = d = 0;
  1559. X   while ( *p != 0 )
  1560. X      {
  1561. X
  1562. X      /* read characters into the arguments buffer */
  1563. X
  1564. X      while( ( isspace( *p ) == 0 ) && ( *p != 0 ))
  1565. X     {
  1566. X     arguments[ c ][ d ] = *p;
  1567. X     ++d;
  1568. X     ++p;
  1569. X     arguments[ c ][ d ] = 0;
  1570. X     }
  1571. X
  1572. X      /* reset d counter and advance to next word */
  1573. X
  1574. X      d = 0;
  1575. X      ++c;
  1576. X
  1577. X      /* eat up trailing whitespace */
  1578. X
  1579. X      while( isspace( *p ))
  1580. X     {
  1581. X     ++p;
  1582. X     }
  1583. X
  1584. #ifdef  OLD_DEBUG
  1585. X      printf( "DEBUG: c is %d \n", c );
  1586. #endif
  1587. X
  1588. X      }
  1589. X
  1590. #ifdef  OLD_DEBUG
  1591. X   printf( "DEBUG: returning %d\n", c );
  1592. #endif
  1593. X   return c;
  1594. X
  1595. X   }
  1596. X
  1597. #endif
  1598. X
  1599. SHAR_EOF
  1600. chmod 0644 sfs/sfs/sfs.c ||
  1601. echo 'restore of sfs/sfs/sfs.c failed'
  1602. Wc_c="`wc -c < 'sfs/sfs/sfs.c'`"
  1603. test 4685 -eq "$Wc_c" ||
  1604.     echo 'sfs/sfs/sfs.c: original size 4685, current size' "$Wc_c"
  1605. rm -f _shar_wnt_.tmp
  1606. fi
  1607. # ============= sfs/sfs/sfs.h ==============
  1608. if test -f 'sfs/sfs/sfs.h' -a X"$1" != X"-c"; then
  1609.     echo 'x - skipping sfs/sfs/sfs.h (File already exists)'
  1610.     rm -f _shar_wnt_.tmp
  1611. else
  1612. > _shar_wnt_.tmp
  1613. echo 'x - extracting sfs/sfs/sfs.h (Text)'
  1614. sed 's/^X//' << 'SHAR_EOF' > 'sfs/sfs/sfs.h' &&
  1615. /***************************************************************
  1616. X
  1617. X    sfs.h           Space Flight Simulator
  1618. X            General Header
  1619. X
  1620. X            Copyright (c) 1991, Ted A. Campbell
  1621. X
  1622. X            Bywater Software
  1623. X            P. O. Box 4023 
  1624. X            Duke Station 
  1625. X            Durham, NC  27706
  1626. X
  1627. X            email: tcamp@hercules.acpub.duke.edu
  1628. X
  1629. X    Copyright and Permissions Information:
  1630. X
  1631. X    All U.S. and international copyrights are claimed by the
  1632. X    author. The author grants permission to use this code
  1633. X    and software based on it under the following conditions:
  1634. X    (a) in general, the code and software based upon it may be 
  1635. X    used by individuals and by non-profit organizations; (b) it
  1636. X    may also be utilized by governmental agencies in any country,
  1637. X    with the exception of military agencies; (c) the code and/or
  1638. X    software based upon it may not be sold for a profit without
  1639. X    an explicit and specific permission from the author, except
  1640. X    that a minimal fee may be charged for media on which it is
  1641. X    copied, and for copying and handling; (d) the code must be 
  1642. X    distributed in the form in which it has been released by the
  1643. X    author; and (e) the code and software based upon it may not 
  1644. X    be used for illegal activities. 
  1645. X
  1646. ***************************************************************/
  1647. X
  1648. /***    Version number -- for all modules */
  1649. X
  1650. #define VERSION "1.01"
  1651. X
  1652. /***    Definitions for all sfs modules */
  1653. X
  1654. #ifndef CR
  1655. #define CR      0x0d
  1656. #endif
  1657. X
  1658. #ifndef LF
  1659. #define LF      0x0a
  1660. #endif
  1661. X
  1662. #ifndef TRUE
  1663. #define TRUE    1
  1664. #define FALSE   0
  1665. #endif
  1666. X
  1667. #define FAR_SEGMENT
  1668. #define FMALLOC         malloc
  1669. X
  1670. #define FT_POINTS       64              /* Points in forward track buffer */
  1671. #define ORBITS          (16)            /* Number of orbits tracked     */
  1672. #define GT_POINTS       512             /* Size of ground track buffer  */
  1673. #define PE_POINTS       64              /* Size of Perspective buffer   */
  1674. #define OR_COLORS       6               /* Colors for orbits */
  1675. #define HORDEGS         30.0            /* Horizontal degrees in window
  1676. X                       for visual display */
  1677. #define DEFAULTFD       "earth.fd"      /* default focal data file */
  1678. #define DEFAULTSD       "null.spd"      /* default surface data point file */
  1679. #define DEFAULTORB      "orb.spd"       /* default orb point file */
  1680. #define DEFAULTGRID     "latlon.spd"    /* default grid point file */
  1681. #define SFS_DEFAULTPROG "default.sfs"   /* default program file */
  1682. #define SFS_CHAINFN     "chain"         /* name for chian file */
  1683. #define SFS_EXITARG     "exit"          /* argument denotes exit from
  1684. X                       program */
  1685. #define SFS_CONTARG     "cont"          /* argument denotes continuation
  1686. X                       (do not show logo) */
  1687. #define SFS_FILESIZE    36              /* size for filename buffers */
  1688. X
  1689. /***    Definitions of names for chain files */
  1690. X
  1691. #define SFSCH_EXIT      "exit"          /* exit from SFS */
  1692. #define SFSCH_SIMUL     "sfsx.app"      /* chain to simulation module */
  1693. #define SFSCH_MODEL     "sfsm.app"      /* chain to modeling module */
  1694. #define SFSCH_ATLAS     "sfsa.app"      /* chain to atlas module */
  1695. X
  1696. /***    Definitions of Display Types */
  1697. X
  1698. #define SFSD_VISUAL     0               /* visual simulation display */
  1699. #define SFSD_PERSP      1               /* distant perspective display */
  1700. #define SFSD_GROUND     2               /* ground track display */
  1701. X
  1702. /***    Definitions of Visual Simulation Elements */
  1703. X
  1704. #define VI_GRIDFRONT    1               /* show front of grid */
  1705. #define VI_GRIDBACK     2               /* show back of grid */
  1706. #define VI_SURFRONT     4               /* show front of surface features */
  1707. #define VI_SURBACK      8               /* show back of surface features */
  1708. #define VI_ORBOUTLINE   16              /* show outline of orb */
  1709. #define VI_ORBBLANK     32              /* blank the orb before drawing */
  1710. #define VI_POINTS       64              /* show points */
  1711. #define VI_PTITLES      128             /* show point titles */
  1712. #define VI_STITLE       256             /* show screen title */
  1713. #define VI_CROSSH       512             /* show crosshair */
  1714. X
  1715. /***    Alignments for Visual Simulation DIsplay */
  1716. X
  1717. #define AL_HORIZON      0
  1718. #define AL_CENTER       1
  1719. X
  1720. /***************************************************************
  1721. X
  1722. X    language-specific definitions
  1723. X
  1724. X    English is taken as a default, and if SFS_TITLE
  1725. X    has not been defined, the English definitions will be
  1726. X    utilized. To translate into other languages, we suggest
  1727. X    that the following section be copied, a language name
  1728. X    defined as one, and then each of the definitions rendered
  1729. X    into the language. Example:
  1730. X
  1731. X    ;#define        LATIN   1
  1732. X    ;
  1733. X    ;
  1734. X    ;#if    LATIN
  1735. X    ;#define        SFS_TITLE        " Astronautica Simulanda "
  1736. X    ;......etc.
  1737. X    ;#endif
  1738. X
  1739. X    SFS_TITLE will then be defined, and the English language
  1740. X    tags will not be called.
  1741. X
  1742. ***************************************************************/
  1743. X
  1744. #ifndef SFS_TITLE
  1745. #define SFS_TITLE       "Space Flight Simulator"
  1746. #define VERABB          "ver."
  1747. #define SFS_LINKERR     "SFS failed to link to the Main Module.\n"
  1748. #define ERR_LTITLE      "Link error"
  1749. #define SFS_CHERR       "SFS failed to chain to %s\n"
  1750. #define ERR_TTITLE      "SFS termination error"
  1751. #define DI_MEMERR       "Cannot allocate memory for display initialization"
  1752. #define DI_DSMEMERR     "Cannot allocate memory for display structures"
  1753. #define DI_DMEMERR      "Cannot allocate memory for display initialization"
  1754. #define VIS_TITLE       "Visual: %s from %s (Orbit %d)"
  1755. #define PER_TITLE       "Perspective: %s orbits"
  1756. #define GTR_TITLE       "Ground Track: %s orbits"
  1757. #define FT_NOTICE       "Initializing forward track for orbit %d"
  1758. #define FT_CALC         "Calculating forward track for orbit %d"
  1759. #define GT_DRAW         "Drawing ground track"
  1760. #define GT_WTITLE       " Ground Track: %s orbit(s)"
  1761. #define GTERR_NODATA    "gt_track(): data is not ready."
  1762. #define PE_CALC         "Calculating perspective points for orbit %d"
  1763. #define PE_DRAW         "Drawing distant perspective"
  1764. #define PE_WTITLE       " %s from %.0lf km; point = %ld seconds "
  1765. #define PRERR_OPEN      "Cannot open program file <%s> "
  1766. #define PR_NOTICE       "Interpreting program file %s; %s "
  1767. #define PRERR_PRI       "Periapsis must be > 0 "
  1768. #define PRERR_APO       "Apoapsis must be > 0 and <= periapsis"
  1769. #define PRERR_INC       "Inclination must be > %.1lf and < %.1lf"
  1770. #define PRERR_LAN       "Long. of asc. node must be > %.1lf and < %.1lf"
  1771. #define PRERR_ARP       "Argument of periapsis must be >= %.1lf and < %.1lf"
  1772. #define PRMEMERR_NAME   "Cannot allocate storage for orbit name."
  1773. #define PRERR_TF        "Time factor must be > 0"
  1774. #define PRERR_UI        "Update interval must be > 0 "
  1775. #define PRERR_TL        "Trig level must be 1 or 2"
  1776. #define PRERR_INS       "Insertion must be > 0"
  1777. #define PRERR_UNKNOWN   "Unknown command %s "
  1778. #define PRMEMERR_SORBIT "Cannot allocate storage for sfs orbit."
  1779. #define PRMEMERR_AORBIT "Cannot allocate storage for as orbit."
  1780. #define PRERR_WRITE     "Cannot open program file %s for writing."
  1781. #define PRMEMERR_FOCUS  "Cannot allocate storage for as focus."
  1782. #define VI_DRAW         "Drawing visual simulation"
  1783. #define VI_WTITLE       " Visual Simulation: %s from %s "
  1784. #define    VI_POS        "Position"
  1785. #define    VI_ORBIT    "Orbit"
  1786. #define    VI_LAT        "LAT"
  1787. #define    VI_LON        "LON"
  1788. #define VI_ALT          "ALT"
  1789. #define TF_TITLE        "Set Time Factor"
  1790. #define TF_LEGEND       "The time factor is the ratio between computed time and real time.  A time factor of 1 is equivalent to real-time.  Enter the time factor as a whole number."
  1791. #define TF_PROMPT       "Time Factor:  "
  1792. #define UI_TITLE        "Set Screen Update Interval"
  1793. #define UI_LEGEND       "The screen update interval determines the amount of time (in seconds) between screen updates.  Enter the screen update interval in seconds."
  1794. #define UI_PROMPT       "Update Interval:   "
  1795. #define TPL_TITLE       "Set Trig Precision Level"
  1796. #define TPL_LEGEND      "The Trig Precision Level specifies the accuracy of trig calculations:  1 = fast, 2 = accurate.  Enter 1 or 2. "
  1797. #define TPL_PROMPT      "Precision Level:  "
  1798. #define MINERR          "ERROR in entry:  Value entered must be more than"
  1799. #define MAXERR          "ERROR in entry:  Value entered must be less than"
  1800. #define PTA             "Please try again"
  1801. #define    SFS_TOGGLE    "Toggle"
  1802. #define PR_PARAMS       "parameters for orbit"
  1803. #define PR_ENDOF        "end of file"
  1804. #define PR_CREATED      "created"
  1805. #endif
  1806. X
  1807. /***    Structure definitions for all sfs modules */
  1808. X
  1809. struct ft_pt                            /* forward track point structure */
  1810. X   {
  1811. X   double  latitude;                    /* latitude of the point */
  1812. X   double  longitude;                   /* longitude of the point */
  1813. X   double  altitude;                    /* altitude of the point */
  1814. X   };
  1815. X
  1816. struct sfs_orbit
  1817. X   {
  1818. X   struct as_orbit *aorbit;             /* as orbit structure */
  1819. X   char *name;                          /* name of this orbit */
  1820. X   struct ft_pt ft_buffer[ FT_POINTS ]; /* Buffer for forward track */
  1821. X   int ft_bufstart;                     /* Start of forward track buffer */
  1822. X   int ft_bufpos;                       /* End of forward track buffer  */
  1823. X   long ft_inc;                         /* Time increment for f.t. */
  1824. X   double gt_buffer[ GT_POINTS ][ 2 ];  /* Ground track buffer */
  1825. X   int gt_bufstart;                     /* Start of ground track buffer */
  1826. X   int gt_bufpos;                       /* End of ground track buffer */
  1827. X   struct ft_pt pe_buffer[ PE_POINTS ]; /* Perspective data buffer */
  1828. X   long pe_inc;                         /* Time increment for perspective */
  1829. X   long ft_t;
  1830. X   long last_time;
  1831. X   char         *orbfile[ SFS_FILESIZE ];       /* orb filename */
  1832. X   char         *gridfile[ SFS_FILESIZE ];      /* grid filename */
  1833. X   char         *surfile[ SFS_FILESIZE ];       /* surface feature filename */
  1834. #ifdef  USEPOINTS
  1835. X   char         *pdfile[ SFS_FILESIZE ];        /* point data filename */
  1836. #endif
  1837. X   struct spj_pt o_start;                    /* start orb structure */
  1838. X   struct spj_pt o_end;                      /* end orb structure */
  1839. X   struct spj_pt g_start;                    /* start grid structure */
  1840. X   struct spj_pt g_end;                      /* end grid structure */
  1841. X   struct spj_pt s_start;                    /* start surface structure */
  1842. X   struct spj_pt s_end;                      /* end surface structure */
  1843. #ifdef  USEPOINTS
  1844. X   struct spj_pt p_start;                    /* start point structure */
  1845. X   struct spj_pt p_end;                      /* end point structure */
  1846. #endif
  1847. X   double ssp_lat;              /* latitude return from or_ssp() */
  1848. X   double ssp_lon;              /* longitude return from or_ssp() */
  1849. X   long ssp_r;                  /* orbit distance return from or_ssp() */
  1850. X   long ssp_n;                  /* orbit number return from or_ssp() */
  1851. X   double nssp_lat;             /* next latitude return from or_ssp() */
  1852. X   double nssp_lon;             /* next longitude return from or_ssp() */
  1853. X   long nssp_r;                 /* next orbit distance return from or_ssp() */
  1854. X   long nssp_n;                 /* next orbit number return from or_ssp() */
  1855. X   double ssp_rot;              /* rotation for orbit */
  1856. X   };
  1857. X
  1858. /***    Structure for displays */
  1859. X
  1860. struct sfs_display
  1861. X   {
  1862. X   int type;                    /* type of display: SFSD_xxx */
  1863. X   int elements;                /* display elements */
  1864. X   int orbit;                   /* orbit number for visual */
  1865. X   struct as_focus *focus;      /* focus for perspective or ground track */
  1866. X   int gt_xsize;                /* Size of ground track map, x */
  1867. X   int gt_ysize;                /* Size of ground track map, y */
  1868. X   int gt_mapbase;              /* Bottom of gt map */
  1869. X   int gt_mapedge;              /* Left edge of groundtrack map */
  1870. X   };
  1871. X
  1872. /***    External declarations for all sfs modules */
  1873. X
  1874. extern double vi_rotate();
  1875. extern long sfs_inc;
  1876. extern long sfs_insertion;
  1877. extern long sfs_tfactor;
  1878. X
  1879. /***    Colors */
  1880. X
  1881. extern  int     cl_mback;               /* Main background color        */
  1882. extern  int     cl_mfore;               /* Main foreground color        */
  1883. extern  int     cl_marker;              /* Color for prompt markers     */
  1884. extern  int     cl_grid;                /* Color for planetary grid     */
  1885. extern  int     cl_surface;             /* Color for planetary surface  */
  1886. extern  int     cl_orbits[ OR_COLORS ]; /* Colors for different orbits  */
  1887. SHAR_EOF
  1888. true || echo 'restore of sfs/sfs/sfs.h failed'
  1889. fi
  1890. echo 'End of  part 17'
  1891. echo 'File sfs/sfs/sfs.h is continued in part 18'
  1892. echo 18 > _shar_seq_.tmp
  1893. exit 0
  1894. exit 0 # Just in case...
  1895. -- 
  1896. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1897. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1898. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1899. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1900.